#include<stdio.h>
#include<stdlib.h>
int lengthOfLongestSubstring(char* s) {
    int slow = 0;
    int quick = 0;
    int size = strlen(s);

    int max = 1;
    if (size == 0)
        return 0;
    if (size == 1)
        return 1;
    int* hash = (int*)calloc(128, sizeof(int));
    for (; quick < size; ) {
        hash[s[quick] - 1]++;
        if (hash[s[quick] - 1] == 2) {
            
            while (hash[s[quick] - 1] != 1) {
                hash[s[slow] - 1]--;
                slow++;
            }
            quick++;
            if (max < quick-slow)
                max = quick-slow;
        }
    }
    return max;
}
int main()
{
    char s[] = { "pwwkew" };
    lengthOfLongestSubstring(s);
	return 0;
}